package _05封装;

public class Man {
	// 属性: 姓名 身高(cm) 体重(kg)
	// 要求:
	// * 属性封装 ,并且限制体重和身高在一个合理的范围内
	// * 重写toString() 返回Man的信息
	
	private String name;
	private double height;
	private double weight;
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public double getHeight() {
		return height;
	}
	public void setHeight(double height) {
		if(height<250&&height>140) {
			this.height = height;
		}
	}
	public double getWeight() {
		return weight;
	}
	public void setWeight(double weight) {
		if(weight<150&&weight>40) {
			this.weight = weight;
		}
	}
	
	@Override
	public String toString() {
		// TODO Auto-generated method stub
		return this.getName()+"体重:"+this.getWeight()+"身高:"+this.getHeight();
	}

}
